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 |
540
|
54 // XXX FIXME XXX -- eliminate the need for these in the functions that |
|
55 // use them? |
|
56 |
525
|
57 #define DEFINE_ARGV(warnfor) \ |
|
58 int argc = args.length (); \ |
540
|
59 int save_argc = argc; \ |
525
|
60 char **argv = make_argv (args, warnfor); \ |
540
|
61 char **save_argv = argv; \ |
525
|
62 if (error_state) \ |
|
63 return retval |
|
64 |
|
65 #define DELETE_ARGV \ |
|
66 do \ |
|
67 { \ |
540
|
68 while (--save_argc >= 0) \ |
|
69 delete [] save_argv[save_argc]; \ |
|
70 delete [] save_argv; \ |
525
|
71 } \ |
|
72 while (0) |
|
73 |
|
74 #endif |
|
75 |
|
76 /* |
|
77 ;;; Local Variables: *** |
|
78 ;;; mode: C++ *** |
|
79 ;;; page-delimiter: "^/\\*" *** |
|
80 ;;; End: *** |
|
81 */ |