Mercurial > hg > octave-nkf
comparison src/defun.h @ 525:509e9a2d93a6
[project @ 1994-07-20 18:45:27 by jwe]
Initial revision
author | jwe |
---|---|
date | Wed, 20 Jul 1994 18:45:27 +0000 |
parents | |
children | 40fef5ae9748 |
comparison
equal
deleted
inserted
replaced
524:2814c75c8398 | 525:509e9a2d93a6 |
---|---|
1 // defun.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_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 | |
33 #define DEFVAR(name, sname, defn, inst_as_fcn, protect, \ | |
34 eternal, sv_fcn, doc) \ | |
35 do \ | |
36 { \ | |
37 builtin_variable sname = \ | |
38 { \ | |
39 name, \ | |
40 new tree_constant (defn), \ | |
41 inst_as_fcn, \ | |
42 protect, \ | |
43 eternal, \ | |
44 sv_fcn, \ | |
45 doc, \ | |
46 }; \ | |
47 install_builtin_variable (&sname); \ | |
48 } \ | |
49 while (0) | |
50 | |
51 #define DEFUN(name, fname, sname, nargin_max, nargout_max, doc) \ | |
52 DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 0, doc) | |
53 | |
54 #define DEFUN_TEXT(name, fname, sname, nargin_max, nargout_max, doc) \ | |
55 DEFUN_INTERNAL (name, fname, sname, nargin_max, nargout_max, 1, doc) | |
56 | |
57 #define DEFUN_MAPPER(name, sname, can_ret_cmplx_for_real, lo, hi, \ | |
58 d_d_map, d_c_map, c_c_map, doc) \ | |
59 do \ | |
60 { \ | |
61 builtin_mapper_function sname = \ | |
62 { \ | |
63 name, \ | |
64 can_ret_cmplx_for_real, \ | |
65 lo, \ | |
66 hi, \ | |
67 d_d_map, \ | |
68 d_c_map, \ | |
69 c_c_map, \ | |
70 doc, \ | |
71 }; \ | |
72 install_builtin_mapper (&sname); \ | |
73 } \ | |
74 while (0) | |
75 | |
76 #define DEFALIAS(alias, name) DEFALIAS_INTERNAL (alias, name) | |
77 | |
78 #ifdef MAKE_BUILTINS | |
79 | |
80 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ | |
81 is_text_fcn, doc) \ | |
82 BEGIN_INSTALL_BUILTIN \ | |
83 extern DECLARE_FUN(fname); \ | |
84 static builtin_function sname = \ | |
85 { name, nargin_max, nargout_max, is_text_fcn, fname, doc }; \ | |
86 install_builtin_function (&sname); \ | |
87 END_INSTALL_BUILTIN | |
88 | |
89 #define DEFALIAS_INTERNAL(alias, name) | |
90 | |
91 #else /* ! MAKE_BUILTINS */ | |
92 | |
93 #define DEFUN_INTERNAL(name, fname, sname, nargin_max, nargout_max, \ | |
94 is_text_fcn, doc) \ | |
95 DECLARE_FUN(fname) | |
96 | |
97 #define DEFALIAS_INTERNAL(alias, name) | |
98 | |
99 #endif /* ! MAKE_BUILTINS */ | |
100 | |
101 #endif | |
102 | |
103 /* | |
104 ;;; Local Variables: *** | |
105 ;;; mode: C++ *** | |
106 ;;; page-delimiter: "^/\\*" *** | |
107 ;;; End: *** | |
108 */ |