525
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
525
|
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 the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 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, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
525
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_defun_int_h) |
|
24 #define octave_defun_int_h 1 |
|
25 |
2405
|
26 #include "variables.h" |
|
27 |
550
|
28 // MAKE_BUILTINS is defined to extract function names and related |
|
29 // information and create the *.def files that are eventually used to |
|
30 // create the buitlins.cc file. |
|
31 |
525
|
32 #ifdef MAKE_BUILTINS |
|
33 |
550
|
34 // Generate code to install name in the symbol table. The script |
|
35 // mkdefs will create a .def file for every .cc file that uses DEFUN, |
|
36 // DEFUN_TEXT, or DEFUN_DLD. |
|
37 |
1957
|
38 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
525
|
39 BEGIN_INSTALL_BUILTIN \ |
1957
|
40 extern DECLARE_FUN (name, args_name, nargout_name); \ |
|
41 DEFINE_FUN_STRUCT (name, is_text_fcn, doc); \ |
|
42 install_builtin_function (S ## name); \ |
525
|
43 END_INSTALL_BUILTIN |
|
44 |
550
|
45 // Generate code for making another name for an existing function. |
|
46 |
|
47 #define DEFALIAS_INTERNAL(alias, name) \ |
|
48 BEGIN_INSTALL_BUILTIN \ |
|
49 alias_builtin (#alias, #name); \ |
|
50 END_INSTALL_BUILTIN |
525
|
51 |
|
52 #else /* ! MAKE_BUILTINS */ |
|
53 |
550
|
54 // Generate the first line of the function definition. This ensures |
|
55 // that the internal functions all have the same signature. |
|
56 |
1957
|
57 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
58 DECLARE_FUN (name, args_name, nargout_name) |
525
|
59 |
550
|
60 // No definition is required for an alias. |
|
61 |
|
62 #define DEFALIAS_INTERNAL(name, alias) |
525
|
63 |
|
64 #endif /* ! MAKE_BUILTINS */ |
|
65 |
703
|
66 // Define the structure that will be used to insert this function into |
|
67 // the symbol table. |
|
68 |
1957
|
69 #define DEFINE_FUN_STRUCT(name, is_text_fcn, doc) \ |
|
70 static builtin_function S ## name (#name, is_text_fcn, F ## name, doc) |
703
|
71 |
1957
|
72 #define DEFINE_FUN_STRUCT_FUN(name) \ |
1755
|
73 builtin_function& \ |
1957
|
74 FS ## name (void) \ |
703
|
75 { \ |
1957
|
76 return S ## name; \ |
703
|
77 } |
|
78 |
1957
|
79 #define DECLARE_FUN(name, args_name, nargout_name) \ |
2086
|
80 octave_value_list F ## name (const octave_value_list& args_name, int nargout_name) |
525
|
81 |
|
82 #endif |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; End: *** |
|
88 */ |