comparison src/defun.h @ 2890:42901f9a9266

[project @ 1997-04-28 01:44:22 by jwe]
author jwe
date Mon, 28 Apr 1997 01:45:58 +0000
parents 8b262e771614
children ac3368dba5d3
comparison
equal deleted inserted replaced
2889:8aa189b811d0 2890:42901f9a9266
59 // redefined. This is just the same as DEFVAR, except that it defines 59 // redefined. This is just the same as DEFVAR, except that it defines
60 // `name' as a variable, and `__name__' as a constant that cannot be 60 // `name' as a variable, and `__name__' as a constant that cannot be
61 // redefined. 61 // redefined.
62 62
63 #define DEFCONST(name, defn, inst_as_fcn, sv_fcn, doc) \ 63 #define DEFCONST(name, defn, inst_as_fcn, sv_fcn, doc) \
64 DEFVAR_INT (#name, SBV_ ## name, defn, inst_as_fcn, 0, sv_fcn, doc); \ 64 DEFVAR_INT (#name, SBV_ ## name, defn, inst_as_fcn, false, sv_fcn, doc); \
65 DEFVAR_INT ("__" ## #name ## "__", XSBV_ ## name, defn, 0, 1, sv_fcn, doc) 65 DEFVAR_INT ("__" ## #name ## "__", XSBV_ ## name, defn, false, true, \
66 sv_fcn, doc)
66 67
67 // This one can be used when `name' cannot be used directly (if it is 68 // This one can be used when `name' cannot be used directly (if it is
68 // already defined as a macro). In that case, name is already a 69 // already defined as a macro). In that case, name is already a
69 // quoted string, and the name of the structure has to be passed too. 70 // quoted string, and the name of the structure has to be passed too.
70 71
71 #define DEFCONSTX(name, sname, defn, inst_as_fcn, sv_fcn, doc) \ 72 #define DEFCONSTX(name, sname, defn, inst_as_fcn, sv_fcn, doc) \
72 DEFVAR_INT (name, sname, defn, inst_as_fcn, 0, sv_fcn, doc); \ 73 DEFVAR_INT (name, sname, defn, inst_as_fcn, false, sv_fcn, doc); \
73 DEFVAR_INT ("__" ## name ## "__", X ## sname, defn, 0, 1, sv_fcn, doc) 74 DEFVAR_INT ("__" ## name ## "__", X ## sname, defn, false, true, sv_fcn, doc)
74 75
75 // How builtin variables are actually installed. 76 // How builtin variables are actually installed.
76 77
77 #define DEFVAR_INT(name, sname, defn, inst_as_fcn, protect, sv_fcn, doc) \ 78 #define DEFVAR_INT(name, sname, defn, inst_as_fcn, protect, sv_fcn, doc) \
78 do \ 79 do \
94 // number of output arguments this function is expected to produce. 95 // number of output arguments this function is expected to produce.
95 // 96 //
96 // doc is the simple help text for the function. 97 // doc is the simple help text for the function.
97 98
98 #define DEFUN(name, args_name, nargout_name, doc) \ 99 #define DEFUN(name, args_name, nargout_name, doc) \
99 DEFUN_INTERNAL (name, args_name, nargout_name, 0, doc) 100 DEFUN_INTERNAL (name, args_name, nargout_name, false, doc)
100 101
101 // Define a builtin text-style function. 102 // Define a builtin text-style function.
102 // 103 //
103 // This is like DEFUN, except that it defines a function that can be 104 // This is like DEFUN, except that it defines a function that can be
104 // called from the Octave language without using parenthesis to 105 // called from the Octave language without using parenthesis to
105 // surround the arguments). 106 // surround the arguments).
106 107
107 #define DEFUN_TEXT(name, args_name, nargout_name, doc) \ 108 #define DEFUN_TEXT(name, args_name, nargout_name, doc) \
108 DEFUN_INTERNAL (name, args_name, nargout_name, 1, doc) 109 DEFUN_INTERNAL (name, args_name, nargout_name, true, doc)
109 110
110 // Define a mapper function. 111 // Define a mapper function.
111 // 112 //
112 // name is the name of the function, unquoqted. 113 // name is the name of the function, unquoqted.
113 // 114 //
136 // 137 //
137 // doc is the simple help text for the function. 138 // doc is the simple help text for the function.
138 139
139 #define DEFUN_MAPPER(name, ch_map, d_d_map, d_c_map, c_c_map, \ 140 #define DEFUN_MAPPER(name, ch_map, d_d_map, d_c_map, c_c_map, \
140 lo, hi, can_ret_cmplx_for_real, doc) \ 141 lo, hi, can_ret_cmplx_for_real, doc) \
141 do \ 142 install_builtin_mapper \
142 { \ 143 (new octave_mapper (ch_map, d_d_map, d_c_map, c_c_map, lo, hi, \
143 builtin_mapper_function S ## name (ch_map, d_d_map, \ 144 can_ret_cmplx_for_real, #name))
144 d_c_map, c_c_map, lo, hi, \
145 can_ret_cmplx_for_real, \
146 #name, doc); \
147 install_builtin_mapper (S ## name); \
148 } \
149 while (0)
150 145
151 // Make alias another name for the existing function name. This macro 146 // Make alias another name for the existing function name. This macro
152 // must be used in the same file where name is defined, after the 147 // must be used in the same file where name is defined, after the
153 // definition for name. 148 // definition for name.
154 149