Mercurial > octave
annotate libinterp/octave-value/ov-builtin.h @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 Copyright (C) 1996-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26917
diff
changeset
|
4 |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26917
diff
changeset
|
5 See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26917
diff
changeset
|
6 or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26917
diff
changeset
|
7 |
2974 | 8 |
9 This file is part of Octave. | |
10 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24239
diff
changeset
|
11 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24239
diff
changeset
|
13 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 (at your option) any later version. |
2974 | 15 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
16 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
17 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
19 GNU General Public License for more details. |
2974 | 20 |
21 You should have received a copy of the GNU General Public License | |
7016 | 22 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24239
diff
changeset
|
23 <https://www.gnu.org/licenses/>. |
2974 | 24 |
25 */ | |
26 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 #if ! defined (octave_ov_builtin_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
28 #define octave_ov_builtin_h 1 |
2974 | 29 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
30 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
31 |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
32 #include <list> |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
33 #include <set> |
2974 | 34 #include <string> |
35 | |
36 #include "ov-fcn.h" | |
37 #include "ov-typeinfo.h" | |
38 | |
39 class octave_value; | |
40 class octave_value_list; | |
41 | |
23518 | 42 namespace octave |
43 { | |
23532
084245f9bd03
pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents:
23520
diff
changeset
|
44 class tree_evaluator; |
23518 | 45 class interpreter; |
24239
51e408a7d38f
jit: Move everything inside the octave namespace
Julien Bect <jbect@users.sourceforge.net>
parents:
23796
diff
changeset
|
46 class jit_type; |
23518 | 47 } |
48 | |
2974 | 49 // Builtin functions. |
50 | |
51 class | |
7349 | 52 OCTINTERP_API |
2974 | 53 octave_builtin : public octave_function |
54 { | |
55 public: | |
56 | |
26440
dc68f987c9ba
oct-builtin.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
57 octave_builtin (void) : octave_function (), f (nullptr), m (nullptr), |
dc68f987c9ba
oct-builtin.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
58 file (), jtype (nullptr) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
59 { } |
4642 | 60 |
23518 | 61 typedef octave_value_list (*meth) (octave::interpreter&, |
62 const octave_value_list&, int); | |
63 | |
2974 | 64 typedef octave_value_list (*fcn) (const octave_value_list&, int); |
65 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
66 octave_builtin (fcn ff, const std::string& nm = "", |
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
67 const std::string& ds = "") |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
68 : octave_function (nm, ds), f (ff), m (nullptr), file (), jtype (nullptr) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
69 { } |
23518 | 70 |
71 octave_builtin (meth mm, const std::string& nm = "", | |
72 const std::string& ds = "") | |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
73 : octave_function (nm, ds), f (nullptr), m (mm), file (), jtype (nullptr) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
74 { } |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
75 |
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
76 octave_builtin (fcn ff, const std::string& nm, const std::string& fnm, |
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
77 const std::string& ds) |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
78 : octave_function (nm, ds), f (ff), m (nullptr), file (fnm), jtype (nullptr) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
79 { } |
23518 | 80 |
81 octave_builtin (meth mm, const std::string& nm, const std::string& fnm, | |
82 const std::string& ds) | |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
83 : octave_function (nm, ds), f (nullptr), m (mm), file (fnm), jtype (nullptr) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
84 { } |
2974 | 85 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
86 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
87 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
88 octave_builtin (const octave_builtin& ob) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
89 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
90 octave_builtin& operator = (const octave_builtin& ob) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
91 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
92 ~octave_builtin (void) = default; |
2974 | 93 |
15005
74c7265c057a
fix failure with function handles caused by changeset ea6997657614
John W. Eaton <jwe@octave.org>
parents:
15004
diff
changeset
|
94 std::string src_file_name (void) const { return file; } |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
95 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
96 octave_function * function_value (bool = false) { return this; } |
2974 | 97 |
3325 | 98 bool is_builtin_function (void) const { return true; } |
99 | |
26917
9dd1d8973877
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26440
diff
changeset
|
100 // We don't need to override both forms of the call method. The using |
9dd1d8973877
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26440
diff
changeset
|
101 // declaration will avoid warnings about partially-overloaded virtual |
9dd1d8973877
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26440
diff
changeset
|
102 // functions. |
9dd1d8973877
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26440
diff
changeset
|
103 using octave_function::call; |
9dd1d8973877
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26440
diff
changeset
|
104 |
23653
3bb0a937c071
avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
105 octave_value_list |
3bb0a937c071
avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
106 call (octave::tree_evaluator& tw, int nargout = 0, |
3bb0a937c071
avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents:
23532
diff
changeset
|
107 const octave_value_list& args = octave_value_list ()); |
2974 | 108 |
24239
51e408a7d38f
jit: Move everything inside the octave namespace
Julien Bect <jbect@users.sourceforge.net>
parents:
23796
diff
changeset
|
109 octave::jit_type * to_jit (void) const; |
14973 | 110 |
24239
51e408a7d38f
jit: Move everything inside the octave namespace
Julien Bect <jbect@users.sourceforge.net>
parents:
23796
diff
changeset
|
111 void stash_jit (octave::jit_type& type); |
14973 | 112 |
14974
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
113 fcn 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
|
114 |
23518 | 115 meth method (void) const; |
116 | |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
117 void 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:
22869
diff
changeset
|
118 |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
119 bool 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:
22869
diff
changeset
|
120 |
3325 | 121 protected: |
122 | |
123 // A pointer to the actual function. | |
124 fcn f; | |
23518 | 125 meth m; |
3325 | 126 |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
127 // The name of the file where this function was defined. |
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
128 std::string file; |
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14974
diff
changeset
|
129 |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
130 // The types this function has been declared to handle (if any). |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
131 std::set<std::string> dispatch_classes; |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
132 |
14973 | 133 // A pointer to the jit type that represents the function. |
24239
51e408a7d38f
jit: Move everything inside the octave namespace
Julien Bect <jbect@users.sourceforge.net>
parents:
23796
diff
changeset
|
134 octave::jit_type *jtype; |
14973 | 135 |
2974 | 136 private: |
137 | |
4612 | 138 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974 | 139 }; |
140 | |
141 #endif |