Mercurial > hg > octave-terminal
changeset 9223:902a4597dce8
use Array<void *> in ov-typeinfo.h
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 20 May 2009 14:13:31 +0200 |
parents | 7bd406e12e4d |
children | a6422d81bee7 4b94672337d0 |
files | src/ChangeLog src/ov-typeinfo.cc src/ov-typeinfo.h |
diffstat | 3 files changed, 75 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2009-05-20 Jaroslav Hajek <highegg@gmail.com> + + * ov-typeinfo.h + (octave_value_typeinfo::unary_class_ops, + octave_value_typeinfo::unary_ops, + octave_value_typeinfo::non_const_unary_ops, + octave_value_typeinfo::binary_class_ops, + octave_value_typeinfo::binary_ops, + octave_value_typeinfo::compound_binary_class_ops, + octave_value_typeinfo::compound_binary_ops, + octave_value_typeinfo::cat_ops, + octave_value_typeinfo::assign_ops, + octave_value_typeinfo::assignany_ops, + octave_value_typeinfo::pref_assign_conv, + octave_value_typeinfo::type_conv_ops, + octave_value_typeinfo::widening_ops): Declare as Array<void *>. + * ov-typeinfo.cc: Reflect changes. + 2009-05-20 Jaroslav Hajek <highegg@gmail.com> * toplev.h (octave_exit_func): New typedef.
--- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -40,38 +40,6 @@ #include <Array2.h> #include <Array3.h> -#include <Array.cc> - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::unary_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::unary_op_fcn, ); -template class Array2<octave_value_typeinfo::unary_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::non_const_unary_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::non_const_unary_op_fcn, ); -template class Array2<octave_value_typeinfo::non_const_unary_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::binary_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::binary_op_fcn, ); -template class Array2<octave_value_typeinfo::binary_op_fcn>; -template class Array3<octave_value_typeinfo::binary_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::cat_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::cat_op_fcn, ); -template class Array2<octave_value_typeinfo::cat_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::assign_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::assign_op_fcn, ); -template class Array2<octave_value_typeinfo::assign_op_fcn>; -template class Array3<octave_value_typeinfo::assign_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_value_typeinfo::assignany_op_fcn); -INSTANTIATE_ARRAY (octave_value_typeinfo::assignany_op_fcn, ); -template class Array2<octave_value_typeinfo::assignany_op_fcn>; - -NO_INSTANTIATE_ARRAY_SORT (octave_base_value::type_conv_fcn); -INSTANTIATE_ARRAY (octave_base_value::type_conv_fcn, ); -template class Array2<octave_base_value::type_conv_fcn>; - bool octave_value_typeinfo::instance_ok (void) { @@ -229,32 +197,28 @@ vals.resize (len, octave_value ()); - unary_ops.resize (static_cast<int> (octave_value::num_unary_ops), - len, static_cast<octave_value_typeinfo::unary_op_fcn> (0)); + unary_ops.resize (static_cast<int> (octave_value::num_unary_ops), len, 0); non_const_unary_ops.resize - (static_cast<int> (octave_value::num_unary_ops), - len, static_cast<octave_value_typeinfo::non_const_unary_op_fcn> (0)); + (static_cast<int> (octave_value::num_unary_ops), len, 0); binary_ops.resize (static_cast<int> (octave_value::num_binary_ops), - len, len, static_cast<octave_value_typeinfo::binary_op_fcn> (0)); + len, len, 0); compound_binary_ops.resize (static_cast<int> (octave_value::num_compound_binary_ops), - len, len, static_cast<octave_value_typeinfo::binary_op_fcn> (0)); + len, len, 0); - cat_ops.resize (len, len, static_cast<octave_value_typeinfo::cat_op_fcn> (0)); + cat_ops.resize (len, len, 0); - assign_ops.resize (static_cast<int> (octave_value::num_assign_ops), - len, len, static_cast<octave_value_typeinfo::assign_op_fcn> (0)); + assign_ops.resize (static_cast<int> (octave_value::num_assign_ops), len, len, 0); - assignany_ops.resize (static_cast<int> (octave_value::num_assign_ops), - len, static_cast<octave_value_typeinfo::assignany_op_fcn> (0)); + assignany_ops.resize (static_cast<int> (octave_value::num_assign_ops), len, 0); pref_assign_conv.resize (len, len, -1); - type_conv_ops.resize (len, len, static_cast<octave_base_value::type_conv_fcn> (0)); + type_conv_ops.resize (len, len, 0); - widening_ops.resize (len, len, static_cast<octave_base_value::type_conv_fcn> (0)); + widening_ops.resize (len, len, 0); } types (i) = t_name; @@ -278,7 +242,7 @@ op_name.c_str ()); } - unary_class_ops.checkelem (static_cast<int> (op)) = f; + unary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f); return false; } @@ -296,7 +260,7 @@ op_name.c_str (), type_name.c_str ()); } - unary_ops.checkelem (static_cast<int> (op), t) = f; + unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f); return false; } @@ -314,7 +278,7 @@ op_name.c_str (), type_name.c_str ()); } - non_const_unary_ops.checkelem (static_cast<int> (op), t) = f; + non_const_unary_ops.checkelem (static_cast<int> (op), t) = reinterpret_cast<void *> (f); return false; } @@ -331,7 +295,7 @@ op_name.c_str ()); } - binary_class_ops.checkelem (static_cast<int> (op)) = f; + binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f); return false; } @@ -351,7 +315,7 @@ op_name.c_str (), t1_name.c_str (), t1_name.c_str ()); } - binary_ops.checkelem (static_cast<int> (op), t1, t2) = f; + binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f); return false; } @@ -368,7 +332,7 @@ op_name.c_str ()); } - compound_binary_class_ops.checkelem (static_cast<int> (op)) = f; + compound_binary_class_ops.checkelem (static_cast<int> (op)) = reinterpret_cast<void *> (f); return false; } @@ -388,7 +352,7 @@ op_name.c_str (), t1_name.c_str (), t1_name.c_str ()); } - compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = f; + compound_binary_ops.checkelem (static_cast<int> (op), t1, t2) = reinterpret_cast<void *> (f); return false; } @@ -405,7 +369,7 @@ t1_name.c_str (), t1_name.c_str ()); } - cat_ops.checkelem (t1, t2) = f; + cat_ops.checkelem (t1, t2) = reinterpret_cast<void *> (f); return false; } @@ -425,7 +389,7 @@ op_name.c_str (), t_lhs_name.c_str (), t_rhs_name.c_str ()); } - assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = f; + assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs) = reinterpret_cast<void *> (f); return false; } @@ -443,7 +407,7 @@ op_name.c_str (), t_lhs_name.c_str ()); } - assignany_ops.checkelem (static_cast<int> (op), t_lhs) = f; + assignany_ops.checkelem (static_cast<int> (op), t_lhs) = reinterpret_cast<void *> (f); return false; } @@ -479,7 +443,7 @@ t_name.c_str (), t_result_name.c_str ()); } - type_conv_ops.checkelem (t, t_result) = f; + type_conv_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f); return false; } @@ -497,7 +461,7 @@ t_name.c_str (), t_result_name.c_str ()); } - widening_ops.checkelem (t, t_result) = f; + widening_ops.checkelem (t, t_result) = reinterpret_cast<void *> (f); return false; } @@ -523,66 +487,76 @@ octave_value_typeinfo::unary_class_op_fcn octave_value_typeinfo::do_lookup_unary_class_op (octave_value::unary_op op) { - return unary_class_ops.checkelem (static_cast<int> (op)); + void *f = unary_class_ops.checkelem (static_cast<int> (op)); + return reinterpret_cast<octave_value_typeinfo::unary_class_op_fcn> (f); } octave_value_typeinfo::unary_op_fcn octave_value_typeinfo::do_lookup_unary_op (octave_value::unary_op op, int t) { - return unary_ops.checkelem (static_cast<int> (op), t); + void *f = unary_ops.checkelem (static_cast<int> (op), t); + return reinterpret_cast<octave_value_typeinfo::unary_op_fcn> (f); } octave_value_typeinfo::non_const_unary_op_fcn octave_value_typeinfo::do_lookup_non_const_unary_op (octave_value::unary_op op, int t) { - return non_const_unary_ops.checkelem (static_cast<int> (op), t); + void *f = non_const_unary_ops.checkelem (static_cast<int> (op), t); + return reinterpret_cast<octave_value_typeinfo::non_const_unary_op_fcn> (f); } octave_value_typeinfo::binary_class_op_fcn octave_value_typeinfo::do_lookup_binary_class_op (octave_value::binary_op op) { - return binary_class_ops.checkelem (static_cast<int> (op)); + void *f = binary_class_ops.checkelem (static_cast<int> (op)); + return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f); } octave_value_typeinfo::binary_op_fcn octave_value_typeinfo::do_lookup_binary_op (octave_value::binary_op op, int t1, int t2) { - return binary_ops.checkelem (static_cast<int> (op), t1, t2); + void *f = binary_ops.checkelem (static_cast<int> (op), t1, t2); + return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f); } octave_value_typeinfo::binary_class_op_fcn octave_value_typeinfo::do_lookup_binary_class_op (octave_value::compound_binary_op op) { - return compound_binary_class_ops.checkelem (static_cast<int> (op)); + void *f = compound_binary_class_ops.checkelem (static_cast<int> (op)); + return reinterpret_cast<octave_value_typeinfo::binary_class_op_fcn> (f); } octave_value_typeinfo::binary_op_fcn octave_value_typeinfo::do_lookup_binary_op (octave_value::compound_binary_op op, int t1, int t2) { - return compound_binary_ops.checkelem (static_cast<int> (op), t1, t2); + void *f = compound_binary_ops.checkelem (static_cast<int> (op), t1, t2); + return reinterpret_cast<octave_value_typeinfo::binary_op_fcn> (f); } octave_value_typeinfo::cat_op_fcn octave_value_typeinfo::do_lookup_cat_op (int t1, int t2) { - return cat_ops.checkelem (t1, t2); + void *f = cat_ops.checkelem (t1, t2); + return reinterpret_cast<octave_value_typeinfo::cat_op_fcn> (f); } octave_value_typeinfo::assign_op_fcn octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs) { - return assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs); + void *f = assign_ops.checkelem (static_cast<int> (op), t_lhs, t_rhs); + return reinterpret_cast<octave_value_typeinfo::assign_op_fcn> (f); } octave_value_typeinfo::assignany_op_fcn octave_value_typeinfo::do_lookup_assignany_op (octave_value::assign_op op, int t_lhs) { - return assignany_ops.checkelem (static_cast<int> (op), t_lhs); + void *f = assignany_ops.checkelem (static_cast<int> (op), t_lhs); + return reinterpret_cast<octave_value_typeinfo::assignany_op_fcn> (f); } int @@ -594,13 +568,15 @@ octave_base_value::type_conv_fcn octave_value_typeinfo::do_lookup_type_conv_op (int t, int t_result) { - return type_conv_ops.checkelem (t, t_result); + void *f = type_conv_ops.checkelem (t, t_result); + return reinterpret_cast<octave_base_value::type_conv_fcn> (f); } octave_base_value::type_conv_fcn octave_value_typeinfo::do_lookup_widening_op (int t, int t_result) { - return widening_ops.checkelem (t, t_result); + void *f = widening_ops.checkelem (t, t_result); + return reinterpret_cast<octave_base_value::type_conv_fcn> (f); } string_vector
--- a/src/ov-typeinfo.h +++ b/src/ov-typeinfo.h @@ -220,31 +220,31 @@ Array<octave_value> vals; - Array<unary_class_op_fcn> unary_class_ops; + Array<void *> unary_class_ops; - Array2<unary_op_fcn> unary_ops; + Array2<void *> unary_ops; - Array2<non_const_unary_op_fcn> non_const_unary_ops; + Array2<void *> non_const_unary_ops; - Array<binary_class_op_fcn> binary_class_ops; + Array<void *> binary_class_ops; - Array3<binary_op_fcn> binary_ops; + Array3<void *> binary_ops; - Array<binary_class_op_fcn> compound_binary_class_ops; + Array<void *> compound_binary_class_ops; - Array3<binary_op_fcn> compound_binary_ops; + Array3<void *> compound_binary_ops; - Array2<cat_op_fcn> cat_ops; + Array2<void *> cat_ops; - Array3<assign_op_fcn> assign_ops; + Array3<void *> assign_ops; - Array2<assignany_op_fcn> assignany_ops; + Array2<void *> assignany_ops; Array2<int> pref_assign_conv; - Array2<octave_base_value::type_conv_fcn> type_conv_ops; + Array2<void *> type_conv_ops; - Array2<octave_base_value::type_conv_fcn> widening_ops; + Array2<void *> widening_ops; int do_register_type (const std::string&, const std::string&, const octave_value&);