Mercurial > hg > octave-nkf
diff src/ov-typeinfo.cc @ 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 | e35b034d3523 |
line wrap: on
line diff
--- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -56,6 +56,9 @@ template class Array2<binary_op_fcn>; template class Array3<binary_op_fcn>; +INSTANTIATE_ARRAY (cat_op_fcn); +template class Array2<cat_op_fcn>; + INSTANTIATE_ARRAY (assign_op_fcn); template class Array2<assign_op_fcn>; template class Array3<assign_op_fcn>; @@ -116,6 +119,13 @@ } bool +octave_value_typeinfo::register_cat_op (int t1, int t2, cat_op_fcn f) +{ + return (instance_ok ()) + ? instance->do_register_cat_op (t1, t2, f) : false; +} + +bool octave_value_typeinfo::register_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs, assign_op_fcn f) @@ -190,6 +200,8 @@ binary_ops.resize (static_cast<int> (octave_value::num_binary_ops), len, len, static_cast<binary_op_fcn> (0)); + cat_ops.resize (len, len, static_cast<cat_op_fcn> (0)); + assign_ops.resize (static_cast<int> (octave_value::num_assign_ops), len, len, static_cast<assign_op_fcn> (0)); @@ -269,6 +281,23 @@ } bool +octave_value_typeinfo::do_register_cat_op (int t1, int t2, cat_op_fcn f) +{ + if (lookup_cat_op (t1, t2)) + { + std::string t1_name = types(t1); + std::string t2_name = types(t2); + + warning ("duplicate concatenation operator for types `%s' and `%s'", + t1_name.c_str (), t1_name.c_str ()); + } + + cat_ops.checkelem (t1, t2) = f; + + return false; +} + +bool octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs, assign_op_fcn f) @@ -398,6 +427,12 @@ return binary_ops.checkelem (static_cast<int> (op), t1, t2); } +cat_op_fcn +octave_value_typeinfo::do_lookup_cat_op (int t1, int t2) +{ + return cat_ops.checkelem (t1, t2); +} + assign_op_fcn octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs)