annotate src/defun-int.h @ 3005:fd2080b2800e

[project @ 1997-05-24 17:37:39 by jwe]
author jwe
date Sat, 24 May 1997 17:38:55 +0000
parents e330cb788508
children 38de16594cb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
1 /*
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
2
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2405
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
4
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
6
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
10 later version.
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
11
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
15 for more details.
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
16
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
1315
611d403c7f3d [project @ 1995-06-25 19:56:32 by jwe]
jwe
parents: 1009
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
20
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
21 */
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
22
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
23 #if !defined (octave_defun_int_h)
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
24 #define octave_defun_int_h 1
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
25
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
26 #include <string>
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
27
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
28 class octave_value;
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
29
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
30 // XXX FIXME XXX -- change to use actual pointer types instead of void*
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
31 // when things are not changing as rapidly.
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
32
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
33 extern void
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
34 install_builtin_mapper (void *mf);
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
35
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
36 extern void
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
37 install_builtin_function (void *f, const string& name, const string& doc,
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
38 bool is_text_fcn = false);
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
39
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
40 extern void
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
41 install_builtin_variable (const string& n, const octave_value& v,
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
42 bool iaf, bool p, bool e, void *svf,
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
43 const string& h);
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
44
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
45 extern void
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
46 alias_builtin (const string& alias, const string& name);
2405
e6adec89527e [project @ 1996-10-14 16:23:48 by jwe]
jwe
parents: 2086
diff changeset
47
550
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
48 // MAKE_BUILTINS is defined to extract function names and related
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
49 // information and create the *.def files that are eventually used to
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
50 // create the buitlins.cc file.
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
51
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
52 #ifdef MAKE_BUILTINS
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
53
550
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
54 // Generate code to install name in the symbol table. The script
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
55 // mkdefs will create a .def file for every .cc file that uses DEFUN,
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
56 // DEFUN_TEXT, or DEFUN_DLD.
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
57
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
58 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
59 BEGIN_INSTALL_BUILTIN \
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
60 extern DECLARE_FUN (name, args_name, nargout_name); \
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
61 install_builtin_function (F ## name, #name, doc, is_text_fcn); \
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
62 END_INSTALL_BUILTIN
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
63
550
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
64 // Generate code for making another name for an existing function.
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
65
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
66 #define DEFALIAS_INTERNAL(alias, name) \
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
67 BEGIN_INSTALL_BUILTIN \
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
68 alias_builtin (#alias, #name); \
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
69 END_INSTALL_BUILTIN
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
70
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
71 #else /* ! MAKE_BUILTINS */
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
72
550
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
73 // Generate the first line of the function definition. This ensures
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
74 // that the internal functions all have the same signature.
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
75
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
76 #define DEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
77 DECLARE_FUN (name, args_name, nargout_name)
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
78
550
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
79 // No definition is required for an alias.
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
80
95ee5e330179 [project @ 1994-07-22 20:17:58 by jwe]
jwe
parents: 540
diff changeset
81 #define DEFALIAS_INTERNAL(name, alias)
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
82
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
83 #endif /* ! MAKE_BUILTINS */
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
84
703
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
85 // Define the structure that will be used to insert this function into
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
86 // the symbol table.
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
87
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
88 #define DEFINE_FUN_INSTALLER_FUN(name, doc) \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
89 bool \
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
90 FS ## name (void) \
703
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
91 { \
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
92 static bool installed = false; \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
93 if (! installed) \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
94 install_builtin_function (F ## name, #name, doc); \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
95 return installed; \
703
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
96 }
21cc5b9b9ed6 [project @ 1994-09-15 02:39:57 by jwe]
jwe
parents: 578
diff changeset
97
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1884
diff changeset
98 #define DECLARE_FUN(name, args_name, nargout_name) \
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
99 octave_value_list \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
100 F ## name (const octave_value_list& args_name, int nargout_name)
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
101
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
102 // How builtin variables are actually installed.
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
103
3005
fd2080b2800e [project @ 1997-05-24 17:37:39 by jwe]
jwe
parents: 2968
diff changeset
104 #define DEFVAR_INTERNAL(name, sname, defn, inst_as_fcn, protect, \
fd2080b2800e [project @ 1997-05-24 17:37:39 by jwe]
jwe
parents: 2968
diff changeset
105 chg_fcn, doc) \
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
106 install_builtin_variable (name, octave_value (defn), inst_as_fcn, \
3005
fd2080b2800e [project @ 1997-05-24 17:37:39 by jwe]
jwe
parents: 2968
diff changeset
107 protect, (chg_fcn != 0), chg_fcn, doc)
2968
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
108
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
109 // How mapper functions are actually installed.
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
110
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
111 #define DEFUN_MAPPER_INTERNAL(name, ch_map, d_d_map, d_c_map, c_c_map, \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
112 lo, hi, can_ret_cmplx_for_real, doc) \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
113 install_builtin_mapper \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
114 (new octave_mapper (ch_map, d_d_map, d_c_map, c_c_map, lo, hi, \
e330cb788508 [project @ 1997-05-15 17:40:29 by jwe]
jwe
parents: 2954
diff changeset
115 can_ret_cmplx_for_real, #name))
525
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
116
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
117 #endif
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
118
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
119 /*
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
120 ;;; Local Variables: ***
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
121 ;;; mode: C++ ***
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
122 ;;; End: ***
509e9a2d93a6 [project @ 1994-07-20 18:45:27 by jwe]
jwe
parents:
diff changeset
123 */