525
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, |
|
4 2004, 2005, 2006, 2007 John W. Eaton |
525
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
525
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
525
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_defun_h) |
|
25 #define octave_defun_h 1 |
|
26 |
|
27 #if defined (octave_defun_dld_h) |
|
28 #error defun.h and defun-dld.h both included in same file! |
|
29 #endif |
|
30 |
|
31 #include "defun-int.h" |
|
32 |
550
|
33 // Define a builtin function. |
|
34 // |
1957
|
35 // name is the name of the function, unqouted. |
550
|
36 // |
2086
|
37 // args_name is the name of the octave_value_list variable used to pass |
1957
|
38 // the argument list to this function. |
550
|
39 // |
1957
|
40 // nargout_name is the name of the int variable used to pass the |
|
41 // number of output arguments this function is expected to produce. |
550
|
42 // |
|
43 // doc is the simple help text for the function. |
|
44 |
1957
|
45 #define DEFUN(name, args_name, nargout_name, doc) \ |
2890
|
46 DEFUN_INTERNAL (name, args_name, nargout_name, false, doc) |
525
|
47 |
3743
|
48 // This one can be used when `name' cannot be used directly (if it is |
|
49 // already defined as a macro). In that case, name is already a |
|
50 // quoted string, and the internal name of the function must be passed |
5794
|
51 // too (the convention is to use a prefix of "F", so "foo" becomes "Ffoo"). |
3743
|
52 |
|
53 #define DEFUNX(name, fname, args_name, nargout_name, doc) \ |
|
54 DEFUNX_INTERNAL (name, fname, args_name, nargout_name, false, doc) |
|
55 |
4208
|
56 // Define a builtin command-style function. |
550
|
57 // |
|
58 // This is like DEFUN, except that it defines a function that can be |
|
59 // called from the Octave language without using parenthesis to |
|
60 // surround the arguments). |
|
61 |
4208
|
62 #define DEFCMD(name, args_name, nargout_name, doc) \ |
2890
|
63 DEFUN_INTERNAL (name, args_name, nargout_name, true, doc) |
525
|
64 |
4208
|
65 // For backward compatibility. |
|
66 |
|
67 #define DEFUN_TEXT DEFCMD |
|
68 |
4234
|
69 // This is a function with a name that can't be hidden by a variable. |
|
70 #define DEFCONSTFUN(name, args_name, nargout_name, doc) \ |
|
71 DEFCONSTFUN_INTERNAL (name, args_name, nargout_name, true, doc) |
|
72 |
550
|
73 // Make alias another name for the existing function name. This macro |
|
74 // must be used in the same file where name is defined, after the |
|
75 // definition for name. |
525
|
76 |
4699
|
77 #define DEFALIAS(alias, name) \ |
|
78 DEFALIAS_INTERNAL (alias, name) |
525
|
79 |
|
80 #endif |
|
81 |
|
82 /* |
|
83 ;;; Local Variables: *** |
|
84 ;;; mode: C++ *** |
|
85 ;;; End: *** |
|
86 */ |