525
|
1 // defun-int.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993, 1994 John W. Eaton |
|
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 |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
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 |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_defun_int_h) |
|
25 #define octave_defun_int_h 1 |
|
26 |
|
27 #ifdef MAKE_BUILTINS |
|
28 |
|
29 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ |
|
30 is_text_fcn, doc) \ |
|
31 BEGIN_INSTALL_BUILTIN \ |
|
32 extern DECLARE_FUN(fname); \ |
|
33 static builtin_function sname = \ |
|
34 { name, nargin_max, nargout_max, is_text_fcn, fname, doc }; \ |
|
35 install_builtin_function (&sname); \ |
|
36 END_INSTALL_BUILTIN |
|
37 |
|
38 #define DEFALIAS_INTERNAL(alias, name) |
|
39 |
|
40 #else /* ! MAKE_BUILTINS */ |
|
41 |
|
42 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ |
|
43 is_text_fcn, doc) \ |
|
44 DECLARE_FUN(fname) |
|
45 |
|
46 #define DEFALIAS_INTERNAL(alias, name) |
|
47 |
|
48 #endif /* ! MAKE_BUILTINS */ |
|
49 |
|
50 #define DECLARE_FUN(fname) \ |
|
51 Octave_object \ |
|
52 fname (const Octave_object& args, int nargout) |
|
53 |
|
54 #define DEFINE_ARGV(warnfor) \ |
|
55 int argc = args.length (); \ |
|
56 char **argv = make_argv (args, warnfor); \ |
|
57 if (error_state) \ |
|
58 return retval |
|
59 |
|
60 #define DELETE_ARGV \ |
|
61 do \ |
|
62 { \ |
|
63 while (--argc) \ |
|
64 delete [] argv[argc]; \ |
|
65 delete [] argv; \ |
|
66 } \ |
|
67 while (0) |
|
68 |
|
69 #endif |
|
70 |
|
71 /* |
|
72 ;;; Local Variables: *** |
|
73 ;;; mode: C++ *** |
|
74 ;;; page-delimiter: "^/\\*" *** |
|
75 ;;; End: *** |
|
76 */ |