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