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