Mercurial > hg > octave-lyh
annotate src/ops.h @ 8283:54c25dc5b17d
parse.y: fix comment
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Oct 2008 13:04:32 -0400 |
parents | 283989f2da9b |
children | 8b1a2555c4e2 |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2003, 2004, 2005, 2006, 2007 |
4 John W. Eaton | |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_ops_h) | |
25 #define octave_ops_h 1 | |
26 | |
4669 | 27 #include "Array-util.h" |
28 | |
2376 | 29 extern void install_ops (void); |
30 | |
3203 | 31 #define INSTALL_UNOP(op, t, f) \ |
32 octave_value_typeinfo::register_unary_op \ | |
33 (octave_value::op, t::static_type_id (), oct_unop_ ## f); | |
34 | |
35 #define INSTALL_NCUNOP(op, t, f) \ | |
36 octave_value_typeinfo::register_non_const_unary_op \ | |
37 (octave_value::op, t::static_type_id (), oct_unop_ ## f); | |
38 | |
2376 | 39 #define INSTALL_BINOP(op, t1, t2, f) \ |
40 octave_value_typeinfo::register_binary_op \ | |
3203 | 41 (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ |
42 oct_binop_ ## f); | |
2376 | 43 |
4915 | 44 #define INSTALL_CATOP(t1, t2, f) \ |
45 octave_value_typeinfo::register_cat_op \ | |
46 (t1::static_type_id (), t2::static_type_id (), oct_catop_ ## f); | |
47 | |
2879 | 48 #define INSTALL_ASSIGNOP(op, t1, t2, f) \ |
2376 | 49 octave_value_typeinfo::register_assign_op \ |
3203 | 50 (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ |
51 oct_assignop_ ## f); | |
2376 | 52 |
3195 | 53 #define INSTALL_ASSIGNANYOP(op, t1, f) \ |
54 octave_value_typeinfo::register_assignany_op \ | |
3203 | 55 (octave_value::op, t1::static_type_id (), oct_assignop_ ## f); |
3195 | 56 |
2376 | 57 #define INSTALL_ASSIGNCONV(t1, t2, tr) \ |
58 octave_value_typeinfo::register_pref_assign_conv \ | |
59 (t1::static_type_id (), t2::static_type_id (), tr::static_type_id ()); | |
60 | |
4901 | 61 #define INSTALL_CONVOP(t1, t2, f) \ |
62 octave_value_typeinfo::register_type_conv_op \ | |
63 (t1::static_type_id (), t2::static_type_id (), oct_conv_ ## f); | |
64 | |
2376 | 65 #define INSTALL_WIDENOP(t1, t2, f) \ |
66 octave_value_typeinfo::register_widening_op \ | |
3203 | 67 (t1::static_type_id (), t2::static_type_id (), oct_conv_ ## f); |
2376 | 68 |
69 #define BOOL_OP1(xt, xn, get_x, yt, yn, get_y) \ | |
70 xt xn = get_x; \ | |
71 yt yn = get_y; | |
72 | |
73 #define BOOL_OP2(x) \ | |
5275 | 74 octave_idx_type nr = x.rows (); \ |
75 octave_idx_type nc = x.columns (); | |
2376 | 76 |
77 #define BOOL_OP3(test) \ | |
2825 | 78 boolMatrix retval (nr, nc); \ |
5275 | 79 for (octave_idx_type j = 0; j < nc; j++) \ |
80 for (octave_idx_type i = 0; i < nr; i++) \ | |
2376 | 81 retval (i, j) = test; \ |
82 return retval; | |
83 | |
2601 | 84 #define SC_MX_BOOL_OP(st, sn, get_s, mt, mn, get_m, test, empty_result) \ |
2376 | 85 do \ |
86 { \ | |
87 BOOL_OP1 (st, sn, get_s, mt, mn, get_m) \ | |
88 BOOL_OP2 (mn) \ | |
2612 | 89 if (nr == 0 || nc == 0) \ |
2601 | 90 return empty_result; \ |
2376 | 91 BOOL_OP3 (test) \ |
92 } \ | |
93 while (0) | |
94 | |
2601 | 95 #define MX_SC_BOOL_OP(mt, mn, get_m, st, sn, get_s, test, empty_result) \ |
2376 | 96 do \ |
97 { \ | |
98 BOOL_OP1 (mt, mn, get_m, st, sn, get_s) \ | |
99 BOOL_OP2 (mn) \ | |
2612 | 100 if (nr == 0 || nc == 0) \ |
2601 | 101 return empty_result; \ |
2376 | 102 BOOL_OP3 (test) \ |
103 } \ | |
104 while (0) | |
105 | |
106 #define MX_MX_BOOL_OP(m1t, m1n, get_m1, m2t, m2n, get_m2, test, op, \ | |
2613 | 107 one_empty_result, two_empty_result) \ |
2376 | 108 do \ |
109 { \ | |
110 BOOL_OP1 (m1t, m1n, get_m1, m2t, m2n, get_m2) \ | |
5275 | 111 octave_idx_type m1_nr = m1n.rows (); \ |
112 octave_idx_type m1_nc = m1n.cols (); \ | |
113 octave_idx_type m2_nr = m2n.rows (); \ | |
114 octave_idx_type m2_nc = m2n.cols (); \ | |
2613 | 115 if (m1_nr == m2_nr && m1_nc == m2_nc) \ |
2376 | 116 { \ |
2613 | 117 if (m1_nr == 0 && m1_nc == 0) \ |
118 return two_empty_result; \ | |
119 else \ | |
120 { \ | |
121 BOOL_OP2 (m1n) \ | |
122 BOOL_OP3 (test) \ | |
123 } \ | |
2376 | 124 } \ |
2613 | 125 else \ |
126 { \ | |
127 if ((m1_nr == 0 && m1_nc == 0) || (m2_nr == 0 && m2_nc == 0)) \ | |
128 return one_empty_result; \ | |
129 else \ | |
130 { \ | |
131 gripe_nonconformant ("operator " op, m1_nr, m1_nc, \ | |
132 m2_nr, m2_nc); \ | |
2825 | 133 return boolMatrix (); \ |
2613 | 134 } \ |
135 } \ | |
2376 | 136 } \ |
137 while (0) | |
138 | |
3203 | 139 #define CAST_UNOP_ARG(t) \ |
5760 | 140 t v = dynamic_cast<t> (a) |
3203 | 141 |
2376 | 142 #define CAST_BINOP_ARGS(t1, t2) \ |
5760 | 143 t1 v1 = dynamic_cast<t1> (a1); \ |
144 t2 v2 = dynamic_cast<t2> (a2) | |
2376 | 145 |
146 #define CAST_CONV_ARG(t) \ | |
5760 | 147 t v = dynamic_cast<t> (a) |
2376 | 148 |
2914 | 149 #define ASSIGNOPDECL(name) \ |
150 static octave_value \ | |
5759 | 151 oct_assignop_ ## name (octave_base_value& a1, \ |
152 const octave_value_list& idx, \ | |
153 const octave_base_value& a2) | |
154 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
155 #define NULLASSIGNOPDECL(name) \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
156 static octave_value \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
157 oct_assignop_ ## name (octave_base_value& a, \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
158 const octave_value_list& idx, \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
159 const octave_base_value&) |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
160 |
5759 | 161 #define ASSIGNANYOPDECL(name) \ |
162 static octave_value \ | |
163 oct_assignop_ ## name (octave_base_value& a1, \ | |
3203 | 164 const octave_value_list& idx, \ |
165 const octave_value& a2) | |
2914 | 166 |
167 #define DEFASSIGNOP(name, t1, t2) \ | |
168 ASSIGNOPDECL (name) | |
169 | |
170 #define DEFASSIGNOP_FN(name, t1, t2, f) \ | |
171 ASSIGNOPDECL (name) \ | |
172 { \ | |
173 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ | |
174 \ | |
175 v1.f (idx, v2.t1 ## _value ()); \ | |
176 return octave_value (); \ | |
177 } | |
178 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
179 #define DEFNULLASSIGNOP_FN(name, t, f) \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
180 NULLASSIGNOPDECL (name) \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
181 { \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
182 CAST_UNOP_ARG (octave_ ## t&); \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
183 \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
184 v.f (idx); \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
185 return octave_value (); \ |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
186 } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7997
diff
changeset
|
187 |
4686 | 188 #define DEFNDASSIGNOP_FN(name, t1, t2, e, f) \ |
189 ASSIGNOPDECL (name) \ | |
190 { \ | |
191 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ | |
192 \ | |
193 v1.f (idx, v2.e ## _value ()); \ | |
194 return octave_value (); \ | |
195 } | |
196 | |
3195 | 197 #define DEFASSIGNANYOP_FN(name, t1, f) \ |
5759 | 198 ASSIGNANYOPDECL (name) \ |
3195 | 199 { \ |
5760 | 200 octave_ ## t1& v1 = dynamic_cast<octave_ ## t1&> (a1); \ |
3195 | 201 \ |
202 v1.f (idx, a2); \ | |
203 return octave_value (); \ | |
204 } | |
205 | |
2914 | 206 #define CONVDECL(name) \ |
5759 | 207 static octave_base_value * \ |
208 oct_conv_ ## name (const octave_base_value& a) | |
3203 | 209 |
210 #define CONVDECLX(name) \ | |
5759 | 211 static octave_base_value * \ |
212 oct_conv_ ## name (const octave_base_value&) | |
2914 | 213 |
4901 | 214 #define DEFCONV(name, a_dummy, b_dummy) \ |
2914 | 215 CONVDECL (name) |
216 | |
4901 | 217 #define DEFCONVFNX(name, tfrom, ovtto, tto, e) \ |
218 CONVDECL (name) \ | |
219 { \ | |
220 CAST_CONV_ARG (const octave_ ## tfrom&); \ | |
221 \ | |
222 return new octave_ ## ovtto (tto ## NDArray (v.e ## array_value ())); \ | |
223 } | |
224 | |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
225 #define DEFCONVFNX2(name, tfrom, ovtto, e) \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
226 CONVDECL (name) \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
227 { \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
228 CAST_CONV_ARG (const octave_ ## tfrom&); \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
229 \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
230 return new octave_ ## ovtto (v.e ## array_value ()); \ |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
231 } |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
232 |
4901 | 233 #define DEFDBLCONVFN(name, ovtfrom, e) \ |
234 CONVDECL (name) \ | |
235 { \ | |
236 CAST_CONV_ARG (const octave_ ## ovtfrom&); \ | |
237 \ | |
238 return new octave_matrix (NDArray (v.e ## _value ())); \ | |
239 } | |
240 | |
5032 | 241 #define DEFSTRINTCONVFN(name, tto) \ |
242 DEFCONVFNX(name, char_matrix_str, tto ## _matrix, tto, char_) | |
243 | |
5992 | 244 #define DEFSTRDBLCONVFN(name, tfrom) \ |
245 DEFCONVFNX(name, tfrom, matrix, , char_) | |
5032 | 246 |
4901 | 247 #define DEFCONVFN(name, tfrom, tto) \ |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
248 DEFCONVFNX2 (name, tfrom, tto ## _matrix, tto ## _) |
4901 | 249 |
250 #define DEFCONVFN2(name, tfrom, sm, tto) \ | |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7922
diff
changeset
|
251 DEFCONVFNX2 (name, tfrom ## _ ## sm, tto ## _matrix, tto ## _) |
4901 | 252 |
3203 | 253 #define UNOPDECL(name, a) \ |
254 static octave_value \ | |
5759 | 255 oct_unop_ ## name (const octave_base_value& a) |
3203 | 256 |
257 #define DEFUNOPX(name, t) \ | |
258 UNOPDECL (name, , ) | |
259 | |
260 #define DEFUNOP(name, t) \ | |
261 UNOPDECL (name, a) | |
262 | |
263 #define DEFUNOP_OP(name, t, op) \ | |
264 UNOPDECL (name, a) \ | |
265 { \ | |
266 CAST_UNOP_ARG (const octave_ ## t&); \ | |
267 return octave_value (op v.t ## _value ()); \ | |
268 } | |
269 | |
4550 | 270 #define DEFNDUNOP_OP(name, t, e, op) \ |
4543 | 271 UNOPDECL (name, a) \ |
272 { \ | |
273 CAST_UNOP_ARG (const octave_ ## t&); \ | |
4550 | 274 return octave_value (op v.e ## _value ()); \ |
4543 | 275 } |
276 | |
5775 | 277 // FIXME -- in some cases, the constructor isn't necessary. |
3203 | 278 |
279 #define DEFUNOP_FN(name, t, f) \ | |
280 UNOPDECL (name, a) \ | |
281 { \ | |
282 CAST_UNOP_ARG (const octave_ ## t&); \ | |
283 return octave_value (f (v.t ## _value ())); \ | |
284 } | |
285 | |
4550 | 286 #define DEFNDUNOP_FN(name, t, e, f) \ |
4543 | 287 UNOPDECL (name, a) \ |
288 { \ | |
289 CAST_UNOP_ARG (const octave_ ## t&); \ | |
4550 | 290 return octave_value (f (v.e ## _value ())); \ |
4543 | 291 } |
292 | |
3203 | 293 #define DEFNCUNOP_METHOD(name, t, method) \ |
294 static void \ | |
5759 | 295 oct_unop_ ## name (octave_base_value& a) \ |
3203 | 296 { \ |
297 CAST_UNOP_ARG (octave_ ## t&); \ | |
298 v.method (); \ | |
299 } | |
300 | |
2914 | 301 #define BINOPDECL(name, a1, a2) \ |
302 static octave_value \ | |
5759 | 303 oct_binop_ ## name (const octave_base_value& a1, const octave_base_value& a2) |
2914 | 304 |
305 #define DEFBINOPX(name, t1, t2) \ | |
306 BINOPDECL (name, , ) | |
307 | |
308 #define DEFBINOP(name, t1, t2) \ | |
309 BINOPDECL (name, a1, a2) | |
310 | |
311 #define DEFBINOP_OP(name, t1, t2, op) \ | |
312 BINOPDECL (name, a1, a2) \ | |
313 { \ | |
314 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ | |
315 return octave_value \ | |
316 (v1.t1 ## _value () op v2.t2 ## _value ()); \ | |
317 } | |
318 | |
7922
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
319 #define DEFSCALARBOOLOP_OP(name, t1, t2, op) \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
320 BINOPDECL (name, a1, a2) \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
321 { \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
322 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
323 if (xisnan (v1.t1 ## _value ()) || xisnan (v2.t2 ## _value ())) \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
324 { \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
325 error ("invalid conversion from NaN to logical"); \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
326 return octave_value (); \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
327 } \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
328 else \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
329 return octave_value \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
330 (v1.t1 ## _value () op v2.t2 ## _value ()); \ |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
331 } |
935be827eaf8
error for NaN values in & and | expressions
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
332 |
4543 | 333 #define DEFNDBINOP_OP(name, t1, t2, e1, e2, op) \ |
334 BINOPDECL (name, a1, a2) \ | |
335 { \ | |
336 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ | |
337 return octave_value \ | |
338 (v1.e1 ## _value () op v2.e2 ## _value ()); \ | |
339 } | |
340 | |
5775 | 341 // FIXME -- in some cases, the constructor isn't necessary. |
2914 | 342 |
343 #define DEFBINOP_FN(name, t1, t2, f) \ | |
344 BINOPDECL (name, a1, a2) \ | |
345 { \ | |
346 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ | |
347 return octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \ | |
348 } | |
349 | |
4543 | 350 #define DEFNDBINOP_FN(name, t1, t2, e1, e2, f) \ |
351 BINOPDECL (name, a1, a2) \ | |
352 { \ | |
353 CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ | |
354 return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \ | |
355 } | |
356 | |
2914 | 357 #define BINOP_NONCONFORMANT(msg) \ |
358 gripe_nonconformant (msg, \ | |
359 a1.rows (), a1.columns (), \ | |
360 a2.rows (), a2.columns ()); \ | |
361 return octave_value () | |
362 | |
4915 | 363 #define CATOPDECL(name, a1, a2) \ |
364 static octave_value \ | |
5759 | 365 oct_catop_ ## name (octave_base_value& a1, const octave_base_value& a2, \ |
6871 | 366 const Array<octave_idx_type>& ra_idx) |
4915 | 367 |
368 #define DEFCATOPX(name, t1, t2) \ | |
369 CATOPDECL (name, , ) | |
370 | |
371 #define DEFCATOP(name, t1, t2) \ | |
372 CATOPDECL (name, a1, a2) | |
373 | |
5775 | 374 // FIXME -- in some cases, the constructor isn't necessary. |
4915 | 375 |
376 #define DEFCATOP_FN(name, t1, t2, f) \ | |
5075 | 377 CATOPDECL (name, a1, a2) \ |
4915 | 378 { \ |
5073 | 379 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ |
5533 | 380 return octave_value (v1.t1 ## _value () . f (v2.t2 ## _value (), ra_idx)); \ |
4915 | 381 } |
382 | |
5075 | 383 #define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ |
384 CATOPDECL (name, a1, a2) \ | |
4915 | 385 { \ |
5073 | 386 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ |
5533 | 387 return octave_value (v1.e1 ## _value () . f (v2.e2 ## _value (), ra_idx)); \ |
388 } | |
389 | |
390 #define DEFNDCHARCATOP_FN(name, t1, t2, f) \ | |
391 CATOPDECL (name, a1, a2) \ | |
392 { \ | |
393 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ | |
394 \ | |
395 return octave_value (v1.char_array_value () . f (v2.char_array_value (), ra_idx), \ | |
396 true, ((a1.is_sq_string () || a2.is_sq_string ()) \ | |
397 ? '\'' : '"')); \ | |
4915 | 398 } |
399 | |
5075 | 400 // For compatibility, the second arg is always converted to the type |
401 // of the first. Hmm. | |
402 | |
403 #define DEFNDCATOP_FN2(name, t1, t2, tc1, tc2, e1, e2, f) \ | |
404 CATOPDECL (name, a1, a2) \ | |
405 { \ | |
406 CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ | |
407 return octave_value (tc1 (v1.e1 ## _value ()) . f (tc2 (v2.e2 ## _value ()), ra_idx)); \ | |
408 } | |
409 | |
4915 | 410 #define CATOP_NONCONFORMANT(msg) \ |
411 gripe_nonconformant (msg, \ | |
412 a1.rows (), a1.columns (), \ | |
413 a2.rows (), a2.columns ()); \ | |
414 return octave_value () | |
415 | |
2376 | 416 #endif |
417 | |
418 /* | |
419 ;;; Local Variables: *** | |
420 ;;; mode: C++ *** | |
421 ;;; End: *** | |
422 */ |