525
|
1 // defun-int.h -*- C++ -*- |
|
2 /* |
|
3 |
1884
|
4 Copyright (C) 1996 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 |
|
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 |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
525
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_defun_int_h) |
|
25 #define octave_defun_int_h 1 |
|
26 |
550
|
27 // MAKE_BUILTINS is defined to extract function names and related |
|
28 // information and create the *.def files that are eventually used to |
|
29 // create the buitlins.cc file. |
|
30 |
525
|
31 #ifdef MAKE_BUILTINS |
|
32 |
550
|
33 // Generate code to install name in the symbol table. The script |
|
34 // mkdefs will create a .def file for every .cc file that uses DEFUN, |
|
35 // DEFUN_TEXT, or DEFUN_DLD. |
|
36 |
1957
|
37 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
525
|
38 BEGIN_INSTALL_BUILTIN \ |
1957
|
39 extern DECLARE_FUN (name, args_name, nargout_name); \ |
|
40 DEFINE_FUN_STRUCT (name, is_text_fcn, doc); \ |
|
41 install_builtin_function (S ## name); \ |
525
|
42 END_INSTALL_BUILTIN |
|
43 |
550
|
44 // Generate code for making another name for an existing function. |
|
45 |
|
46 #define DEFALIAS_INTERNAL(alias, name) \ |
|
47 BEGIN_INSTALL_BUILTIN \ |
|
48 alias_builtin (#alias, #name); \ |
|
49 END_INSTALL_BUILTIN |
525
|
50 |
|
51 #else /* ! MAKE_BUILTINS */ |
|
52 |
550
|
53 // Generate the first line of the function definition. This ensures |
|
54 // that the internal functions all have the same signature. |
|
55 |
1957
|
56 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
57 DECLARE_FUN (name, args_name, nargout_name) |
525
|
58 |
550
|
59 // No definition is required for an alias. |
|
60 |
|
61 #define DEFALIAS_INTERNAL(name, alias) |
525
|
62 |
|
63 #endif /* ! MAKE_BUILTINS */ |
|
64 |
703
|
65 // Define the structure that will be used to insert this function into |
|
66 // the symbol table. |
|
67 |
1957
|
68 #define DEFINE_FUN_STRUCT(name, is_text_fcn, doc) \ |
|
69 static builtin_function S ## name (#name, is_text_fcn, F ## name, doc) |
703
|
70 |
1957
|
71 #define DEFINE_FUN_STRUCT_FUN(name) \ |
1755
|
72 builtin_function& \ |
1957
|
73 FS ## name (void) \ |
703
|
74 { \ |
1957
|
75 return S ## name; \ |
703
|
76 } |
|
77 |
1957
|
78 #define DECLARE_FUN(name, args_name, nargout_name) \ |
|
79 Octave_object F ## name (const Octave_object& args_name, int nargout_name) |
525
|
80 |
|
81 #endif |
|
82 |
|
83 /* |
|
84 ;;; Local Variables: *** |
|
85 ;;; mode: C++ *** |
|
86 ;;; page-delimiter: "^/\\*" *** |
|
87 ;;; End: *** |
|
88 */ |