Mercurial > hg > octave-nkf
diff src/ops.h @ 4915:c638c144d4da
[project @ 2004-07-23 19:01:22 by jwe]
author | jwe |
---|---|
date | Fri, 23 Jul 2004 19:01:23 +0000 |
parents | 35bfb4e0b96b |
children | 3361e0846469 |
line wrap: on
line diff
--- a/src/ops.h +++ b/src/ops.h @@ -40,6 +40,10 @@ (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ oct_binop_ ## f); +#define INSTALL_CATOP(t1, t2, f) \ + octave_value_typeinfo::register_cat_op \ + (t1::static_type_id (), t2::static_type_id (), oct_catop_ ## f); + #define INSTALL_ASSIGNOP(op, t1, t2, f) \ octave_value_typeinfo::register_assign_op \ (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ @@ -306,6 +310,39 @@ a2.rows (), a2.columns ()); \ return octave_value () +#define CATOPDECL(name, a1, a2) \ + static octave_value \ + oct_catop_ ## name (const octave_value& a1, const octave_value& a2, \ + const Array<int>& ra_idx) + +#define DEFCATOPX(name, t1, t2) \ + CATOPDECL (name, , ) + +#define DEFCATOP(name, t1, t2) \ + CATOPDECL (name, a1, a2) + +// XXX FIXME XXX -- in some cases, the constructor isn't necessary. + +#define DEFCATOP_FN(name, t1, t2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ + } + +#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value (), ra_idx)); \ + } + +#define CATOP_NONCONFORMANT(msg) \ + gripe_nonconformant (msg, \ + a1.rows (), a1.columns (), \ + a2.rows (), a2.columns ()); \ + return octave_value () + #endif /*