GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
defun-dld.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_defun_dld_h)
27 #define octave_defun_dld_h 1
28 
29 #include "octave-config.h"
30 
31 #if defined (octave_defun_h)
32 # error defun.h and defun-dld.h both included in same file!
33 #endif
34 
35 #include "defun-int.h"
36 
37 //! Macro to define an at run time dynamically loadable builtin function.
38 //!
39 //! For detailed information, see \ref Macros.
40 //!
41 //! @param name The **unquoted** name of the function that should be installed
42 //! on the 'octave::symbol_table' and can be called by the
43 //! interpreter. Internally, the function name is prepended by an
44 //! 'F'.
45 //! @param args_name The name of the octave_value_list variable used to pass
46 //! the argument list to this function. If this value is
47 //! omitted, the function cannot access the argument list.
48 //! @param nargout_name The name of the 'int' variable used to pass the number
49 //! of output arguments this function is expected to
50 //! produce from the caller. If this value is
51 //! omitted, the function cannot access this number.
52 //! @param doc Texinfo help text (docstring) for the function.
53 //!
54 //! @see DEFMETHOD_DLD
55 
56 // The order of this macro for name = foo is:
57 // 1. Forward declaration of Ffoo.
58 // 2. Definition of installation function Gfoo.
59 // 3. Definition of Ffoo.
60 
61 #define DEFUN_DLD(name, args_name, nargout_name, doc) \
62  FORWARD_DECLARE_FUN (name); \
63  DEFINE_FUN_INSTALLER_FUN (name, doc) \
64  DECLARE_FUN (name, args_name, nargout_name)
65 
66 #define DEFUNX_DLD(name, fname, gname, args_name, nargout_name, doc) \
67  FORWARD_DECLARE_FUNX (fname); \
68  DEFINE_FUNX_INSTALLER_FUN (name, fname, gname, doc) \
69  DECLARE_FUNX (fname, args_name, nargout_name)
70 
71 //! Macro to define an at run time dynamically loadable builtin method.
72 //!
73 //! For detailed information, see \ref Macros.
74 //!
75 //! @param name The **unquoted** name of the method that should be installed
76 //! on the 'octave::symbol_table' and can be called by the
77 //! interpreter. Internally, the method name is prepended by an
78 //! 'F'.
79 //! @param interp_name The name of the 'octave::interpreter' reference that can
80 //! be used by this method. If this value is omitted,
81 //! there is no access to the interpreter and one should
82 //! use #DEFUN to define a function instead.
83 //! @param args_name The name of the octave_value_list variable used to pass
84 //! the argument list to this method. If this value is
85 //! omitted, the method cannot access the argument list.
86 //! @param nargout_name The name of the 'int' variable used to pass the number
87 //! of output arguments this method is expected to
88 //! produce from the caller. If this value is
89 //! omitted, the method cannot access this number.
90 //! @param doc Texinfo help text (docstring) for the method.
91 //!
92 //! @see DEFUN_DLD
93 
94 // The order of this macro for name = foo is again:
95 // 1. Forward declaration of Ffoo.
96 // 2. Definition of installation function Gfoo.
97 // 3. Definition of Ffoo.
98 
99 #define DEFMETHOD_DLD(name, interp_name, args_name, nargout_name, doc) \
100  FORWARD_DECLARE_METHOD (name); \
101  DEFINE_FUN_INSTALLER_FUN (name, doc) \
102  DECLARE_METHOD (name, interp_name, args_name, nargout_name)
103 
104 #define DEFMETHODX_DLD(name, fname, gname, interp_name, args_name, \
105  nargout_name, doc) \
106  FORWARD_DECLARE_METHODX (fname); \
107  DEFINE_FUNX_INSTALLER_FUN (name, fname, gname, doc) \
108  DECLARE_METHODX (fname, interp_name, args_name, nargout_name)
109 
110 #endif