1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
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. |
1
|
20 |
|
21 */ |
|
22 |
240
|
23 #ifdef HAVE_CONFIG_H |
1192
|
24 #include <config.h> |
1
|
25 #endif |
|
26 |
2089
|
27 #include <cctype> |
3010
|
28 #include <cfloat> |
1
|
29 |
3156
|
30 #include "lo-specfun.h" |
2889
|
31 #include "lo-mappers.h" |
|
32 |
1352
|
33 #include "defun.h" |
|
34 #include "error.h" |
2970
|
35 #include "ov-mapper.h" |
2955
|
36 #include "variables.h" |
1
|
37 |
2190
|
38 // XXX FIXME XXX -- perhaps this could be avoided by determining |
|
39 // whether the is* functions are actually functions or just macros. |
|
40 |
2889
|
41 static int |
2190
|
42 xisalnum (int c) |
|
43 { |
|
44 return isalnum (c); |
|
45 } |
|
46 |
2889
|
47 static int |
2190
|
48 xisalpha (int c) |
|
49 { |
|
50 return isalpha (c); |
|
51 } |
|
52 |
2889
|
53 static int |
2190
|
54 xisascii (int c) |
|
55 { |
|
56 return isascii (c); |
|
57 } |
|
58 |
2889
|
59 static int |
2190
|
60 xiscntrl (int c) |
|
61 { |
|
62 return iscntrl (c); |
|
63 } |
|
64 |
2889
|
65 static int |
2190
|
66 xisdigit (int c) |
|
67 { |
|
68 return isdigit (c); |
|
69 } |
|
70 |
2889
|
71 static int |
2190
|
72 xisgraph (int c) |
|
73 { |
|
74 return isgraph (c); |
|
75 } |
|
76 |
2889
|
77 static int |
2190
|
78 xislower (int c) |
|
79 { |
|
80 return islower (c); |
|
81 } |
|
82 |
2889
|
83 static int |
2190
|
84 xisprint (int c) |
|
85 { |
|
86 return isprint (c); |
|
87 } |
|
88 |
2889
|
89 static int |
2190
|
90 xispunct (int c) |
|
91 { |
|
92 return ispunct (c); |
|
93 } |
|
94 |
2889
|
95 static int |
2190
|
96 xisspace (int c) |
|
97 { |
|
98 return isspace (c); |
|
99 } |
|
100 |
2889
|
101 static int |
2190
|
102 xisupper (int c) |
|
103 { |
|
104 return isupper (c); |
|
105 } |
|
106 |
2889
|
107 static int |
2190
|
108 xisxdigit (int c) |
|
109 { |
|
110 return isxdigit (c); |
|
111 } |
|
112 |
2889
|
113 static int |
2267
|
114 xtoascii (int c) |
|
115 { |
|
116 return toascii (c); |
|
117 } |
|
118 |
2889
|
119 static int |
2267
|
120 xtolower (int c) |
|
121 { |
|
122 return tolower (c); |
|
123 } |
|
124 |
2889
|
125 static int |
2267
|
126 xtoupper (int c) |
|
127 { |
|
128 return toupper (c); |
|
129 } |
|
130 |
529
|
131 void |
|
132 install_mapper_functions (void) |
|
133 { |
2089
|
134 DEFUN_MAPPER (abs, 0, fabs, abs, 0, 0.0, 0.0, 0, |
529
|
135 "abs (X): compute abs (X) for each element of X"); |
|
136 |
2089
|
137 DEFUN_MAPPER (acos, 0, acos, 0, acos, -1.0, 1.0, 1, |
529
|
138 "acos (X): compute acos (X) for each element of X"); |
|
139 |
2089
|
140 DEFUN_MAPPER (acosh, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1, |
529
|
141 "acosh (X): compute acosh (X) for each element of X"); |
|
142 |
2089
|
143 DEFUN_MAPPER (angle, 0, arg, arg, 0, 0.0, 0.0, 0, |
529
|
144 "angle (X): compute arg (X) for each element of X"); |
|
145 |
2089
|
146 DEFUN_MAPPER (arg, 0, arg, arg, 0, 0.0, 0.0, 0, |
529
|
147 "arg (X): compute arg (X) for each element of X"); |
|
148 |
2089
|
149 DEFUN_MAPPER (asin, 0, asin, 0, asin, -1.0, 1.0, 1, |
529
|
150 "asin (X): compute asin (X) for each element of X"); |
|
151 |
2089
|
152 DEFUN_MAPPER (asinh, 0, asinh, 0, asinh, 0.0, 0.0, 0, |
529
|
153 "asinh (X): compute asinh (X) for each element of X"); |
|
154 |
2089
|
155 DEFUN_MAPPER (atan, 0, atan, 0, atan, 0.0, 0.0, 0, |
529
|
156 "atan (X): compute atan (X) for each element of X"); |
|
157 |
2089
|
158 DEFUN_MAPPER (atanh, 0, atanh, 0, atanh, -1.0, 1.0, 1, |
529
|
159 "atanh (X): compute atanh (X) for each element of X"); |
|
160 |
2089
|
161 DEFUN_MAPPER (ceil, 0, ceil, 0, ceil, 0.0, 0.0, 0, |
529
|
162 "ceil (X): round elements of X toward +Inf"); |
|
163 |
2089
|
164 DEFUN_MAPPER (conj, 0, conj, 0, conj, 0.0, 0.0, 0, |
529
|
165 "conj (X): compute complex conjugate for each element of X"); |
|
166 |
2089
|
167 DEFUN_MAPPER (cos, 0, cos, 0, cos, 0.0, 0.0, 0, |
529
|
168 "cos (X): compute cos (X) for each element of X"); |
|
169 |
2089
|
170 DEFUN_MAPPER (cosh, 0, cosh, 0, cosh, 0.0, 0.0, 0, |
529
|
171 "cosh (X): compute cosh (X) for each element of X"); |
|
172 |
2089
|
173 DEFUN_MAPPER (erf, 0, xerf, 0, 0, 0.0, 0.0, 0, |
624
|
174 "erf (X): compute erf (X) for each element of X"); |
|
175 |
2089
|
176 DEFUN_MAPPER (erfc, 0, xerfc, 0, 0, 0.0, 0.0, 0, |
624
|
177 "erfc (X): compute erfc (X) for each element of X"); |
|
178 |
2089
|
179 DEFUN_MAPPER (exp, 0, exp, 0, exp, 0.0, 0.0, 0, |
529
|
180 "exp (X): compute exp (X) for each element of X"); |
|
181 |
2089
|
182 DEFUN_MAPPER (finite, 0, xfinite, xfinite, 0, 0.0, 0.0, 0, |
529
|
183 "finite (X): return 1 for finite elements of X"); |
|
184 |
2089
|
185 DEFUN_MAPPER (fix, 0, fix, 0, fix, 0.0, 0.0, 0, |
529
|
186 "fix (X): round elements of X toward zero"); |
|
187 |
2089
|
188 DEFUN_MAPPER (floor, 0, floor, 0, floor, 0.0, 0.0, 0, |
529
|
189 "floor (X): round elements of X toward -Inf"); |
|
190 |
2089
|
191 DEFUN_MAPPER (gamma, 0, xgamma, 0, 0, 0.0, 0.0, 0, |
624
|
192 "gamma (X): compute gamma (X) for each element of X"); |
|
193 |
2089
|
194 DEFUN_MAPPER (imag, 0, imag, imag, 0, 0.0, 0.0, 0, |
|
195 "imag (X): return imaginary part for each elements of X"); |
|
196 |
2190
|
197 DEFUN_MAPPER (isalnum, xisalnum, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
198 "isalnum (X): "); |
|
199 |
2190
|
200 DEFUN_MAPPER (isalpha, xisalpha, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
201 "isalpha (X): "); |
|
202 |
2190
|
203 DEFUN_MAPPER (isascii, xisascii, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
204 "isascii (X): "); |
|
205 |
2190
|
206 DEFUN_MAPPER (iscntrl, xiscntrl, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
207 "iscntrl (X): "); |
|
208 |
2190
|
209 DEFUN_MAPPER (isdigit, xisdigit, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
210 "isdigit (X): "); |
|
211 |
|
212 DEFUN_MAPPER (isinf, 0, xisinf, xisinf, 0, 0.0, 0.0, 0, |
529
|
213 "isinf (X): return 1 for elements of X infinite"); |
|
214 |
2190
|
215 DEFUN_MAPPER (isgraph, xisgraph, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
216 "isgraph (X): "); |
529
|
217 |
2190
|
218 DEFUN_MAPPER (islower, xislower, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
219 "islower (X): "); |
|
220 |
|
221 DEFUN_MAPPER (isnan, 0, xisnan, xisnan, 0, 0.0, 0.0, 0, |
529
|
222 "isnan (X): return 1 where elements of X are NaNs"); |
624
|
223 |
2190
|
224 DEFUN_MAPPER (isprint, xisprint, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
225 "isprint (X): "); |
|
226 |
2190
|
227 DEFUN_MAPPER (ispunct, xispunct, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
228 "ispunct (X): "); |
|
229 |
2190
|
230 DEFUN_MAPPER (isspace, xisspace, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
231 "isspace (X): "); |
|
232 |
2190
|
233 DEFUN_MAPPER (isupper, xisupper, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
234 "isupper (X): "); |
|
235 |
2190
|
236 DEFUN_MAPPER (isxdigit, xisxdigit, 0, 0, 0, 0.0, 0.0, 0, |
2089
|
237 "isxdigit (X): "); |
|
238 |
|
239 DEFUN_MAPPER (lgamma, 0, xlgamma, 0, 0, 0.0, 0.0, 0, |
624
|
240 "lgamma (X): compute log gamma (X) for each element of X"); |
529
|
241 |
2089
|
242 DEFUN_MAPPER (log, 0, log, 0, log, 0.0, DBL_MAX, 1, |
529
|
243 "log (X): compute log (X) for each element of X"); |
|
244 |
2089
|
245 DEFUN_MAPPER (log10, 0, log10, 0, log10, 0.0, DBL_MAX, 1, |
529
|
246 "log10 (X): compute log10 (X) for each element of X"); |
|
247 |
2089
|
248 DEFUN_MAPPER (real, 0, real, real, 0, 0.0, 0.0, 0, |
529
|
249 "real (X): return real part for each element of X"); |
|
250 |
2089
|
251 DEFUN_MAPPER (round, 0, round, 0, round, 0.0, 0.0, 0, |
529
|
252 "round (X): round elements of X to nearest integer"); |
|
253 |
2089
|
254 DEFUN_MAPPER (sign, 0, signum, 0, signum, 0.0, 0.0, 0, |
529
|
255 "sign (X): apply signum function to elements of X"); |
|
256 |
2089
|
257 DEFUN_MAPPER (sin, 0, sin, 0, sin, 0.0, 0.0, 0, |
529
|
258 "sin (X): compute sin (X) for each element of X"); |
|
259 |
2089
|
260 DEFUN_MAPPER (sinh, 0, sinh, 0, sinh, 0.0, 0.0, 0, |
529
|
261 "sinh (X): compute sinh (X) for each element of X"); |
|
262 |
2089
|
263 DEFUN_MAPPER (sqrt, 0, sqrt, 0, sqrt, 0.0, DBL_MAX, 1, |
529
|
264 "sqrt (X): compute sqrt (X) for each element of X"); |
|
265 |
2089
|
266 DEFUN_MAPPER (tan, 0, tan, 0, tan, 0.0, 0.0, 0, |
529
|
267 "tan (X): compute tan (X) for each element of X"); |
|
268 |
2089
|
269 DEFUN_MAPPER (tanh, 0, tanh, 0, tanh, 0.0, 0.0, 0, |
529
|
270 "tanh (X): compute tanh (X) for each element of X"); |
1562
|
271 |
2267
|
272 DEFUN_MAPPER (toascii, xtoascii, 0, 0, 0, 0.0, 0.0, 1, |
|
273 "toascii (STRING): return ASCII representation of STRING in a matrix"); |
|
274 |
|
275 DEFUN_MAPPER (tolower, xtolower, 0, 0, 0, 0.0, 0.0, 2, |
|
276 "tolower (STRING): convert upper case characters to lower case in STRING"); |
|
277 |
|
278 DEFUN_MAPPER (toupper, xtoupper, 0, 0, 0, 0.0, 0.0, 2, |
|
279 "toupper (STRING): convert lower case characters to upper case in STRING"); |
|
280 |
1562
|
281 DEFALIAS (gammaln, lgamma); |
529
|
282 } |
|
283 |
1
|
284 /* |
|
285 ;;; Local Variables: *** |
|
286 ;;; mode: C++ *** |
|
287 ;;; End: *** |
|
288 */ |