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