annotate libinterp/octave-value/ov-builtin.h @ 33343:eb8a24370c2b

Do not hardcode visibility attributes in macros that are used downstream. * ov-base.h (DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API, DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA_API, DECLARE_TEMPLATE_OV_TYPEID_SPECIALIZATIONS_API): Add macros that allow passing visibility attributed. * remaining files: Use new macros passing OCTINTERP_API.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 06 Apr 2024 18:44:45 +0200
parents 4b601ca024d5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31837
diff changeset
3 // Copyright (C) 1996-2024 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #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
27 #define octave_ov_builtin_h 1
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21017
diff changeset
30
22897
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
31 #include <list>
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
32 #include <set>
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
33 #include <string>
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
34
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
35 #include "ov-fcn.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
36 #include "ov-typeinfo.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
37
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
38 class octave_value;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
39 class octave_value_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
40
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
41 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
42
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
43 class tree_evaluator;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
44 class interpreter;
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
45
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
46 OCTAVE_END_NAMESPACE(octave)
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
47
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
48 // Builtin functions.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
49
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 31837
diff changeset
50 class OCTINTERP_API octave_builtin : public octave_function
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
51 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
52 public:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
53
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
54 octave_builtin ()
29949
f254c302bb9c remove JIT compiler from Octave sources
John W. Eaton <jwe@octave.org>
parents: 29466
diff changeset
55 : octave_function (), m_fcn (nullptr), m_meth (nullptr), m_file ()
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
56 { }
4642
7a83d52d2aed [project @ 2003-11-22 12:19:34 by jwe]
jwe
parents: 4612
diff changeset
57
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
58 typedef octave_value_list (*meth) (octave::interpreter&,
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
59 const octave_value_list&, int);
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
60
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
61 typedef octave_value_list (*fcn) (const octave_value_list&, int);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
62
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20791
diff changeset
63 octave_builtin (fcn ff, const std::string& nm = "",
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20791
diff changeset
64 const std::string& ds = "")
29949
f254c302bb9c remove JIT compiler from Octave sources
John W. Eaton <jwe@octave.org>
parents: 29466
diff changeset
65 : octave_function (nm, ds), m_fcn (ff), m_meth (nullptr), m_file ()
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
66 { }
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
67
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
68 octave_builtin (meth mm, const std::string& nm = "",
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
69 const std::string& ds = "")
29949
f254c302bb9c remove JIT compiler from Octave sources
John W. Eaton <jwe@octave.org>
parents: 29466
diff changeset
70 : octave_function (nm, ds), m_fcn (nullptr), m_meth (mm), m_file ()
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
71 { }
15004
ea6997657614 which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents: 14974
diff changeset
72
ea6997657614 which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents: 14974
diff changeset
73 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
74 const std::string& ds)
29949
f254c302bb9c remove JIT compiler from Octave sources
John W. Eaton <jwe@octave.org>
parents: 29466
diff changeset
75 : octave_function (nm, ds), m_fcn (ff), m_meth (nullptr), m_file (fnm)
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
76 { }
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
77
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
78 octave_builtin (meth mm, const std::string& nm, const std::string& fnm,
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
79 const std::string& ds)
29949
f254c302bb9c remove JIT compiler from Octave sources
John W. Eaton <jwe@octave.org>
parents: 29466
diff changeset
80 : octave_function (nm, ds), m_fcn (nullptr), m_meth (mm), m_file (fnm)
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
81 { }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
82
31837
febd82d1a8de use new macros to consistently delete copy and move member functions
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
83 OCTAVE_DISABLE_COPY_MOVE (octave_builtin)
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
84
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
85 ~octave_builtin () = default;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
86
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
87 std::string src_file_name () const { return m_file; }
15004
ea6997657614 which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents: 14974
diff changeset
88
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
89 octave_function * function_value (bool = false) { return this; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
90
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
91 bool is_builtin_function () const { return true; }
3325
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3219
diff changeset
92
23653
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
93 octave_value_list
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
94 execute (octave::tree_evaluator& tw, int nargout = 0,
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
95 const octave_value_list& args = octave_value_list ());
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
96
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
97 fcn function () const;
14974
e3cd4c9d7ccc Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents: 14973
diff changeset
98
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
99 meth method () const;
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23502
diff changeset
100
22897
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
101 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
102
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
103 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
104
3325
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3219
diff changeset
105 protected:
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3219
diff changeset
106
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3219
diff changeset
107 // A pointer to the actual function.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
108 fcn m_fcn;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
109 meth m_meth;
3325
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3219
diff changeset
110
15004
ea6997657614 which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents: 14974
diff changeset
111 // The name of the file where this function was defined.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
112 std::string m_file;
15004
ea6997657614 which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents: 14974
diff changeset
113
22897
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
114 // The types this function has been declared to handle (if any).
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
115 std::set<std::string> m_dispatch_classes;
22897
4090c32fccf8 store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
116
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
117 private:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
118
33343
eb8a24370c2b Do not hardcode visibility attributes in macros that are used downstream.
Markus Mützel <markus.muetzel@gmx.de>
parents: 32633
diff changeset
119 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API (OCTINTERP_API)
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
120 };
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
121
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
122 #endif