# HG changeset patch # User Jaroslav Hajek # Date 1244971945 -7200 # Node ID 0c4e6a3d6e3ea81ce57fa5454db101722148ff7b # Parent 70e0d3b1f26f85bce277a3fb2d4e5b9047731fab support char arrays in lookup diff -r 70e0d3b1f26f -r 0c4e6a3d6e3e src/ChangeLog --- a/src/ChangeLog Fri Jun 12 13:29:25 2009 -0400 +++ b/src/ChangeLog Sun Jun 14 11:32:25 2009 +0200 @@ -1,3 +1,7 @@ +2009-06-14 Jaroslav Hajek + + * DLD-FUNCTIONS/lookup.cc (Flookup): Support character array lookup. + 2009-06-12 John W. Eaton * ov-fcn-handle.cc (make_fcn_handle): Accept operators which have diff -r 70e0d3b1f26f -r 0c4e6a3d6e3e src/DLD-FUNCTIONS/lookup.cc --- a/src/DLD-FUNCTIONS/lookup.cc Fri Jun 12 13:29:25 2009 -0400 +++ b/src/DLD-FUNCTIONS/lookup.cc Sun Jun 14 11:32:25 2009 +0200 @@ -186,7 +186,8 @@ if (table.ndims () > 2 || (table.columns () > 1 && table.rows () > 1)) warning ("lookup: table is not a vector"); - bool num_case = table.is_numeric_type () && y.is_numeric_type (); + bool num_case = ((table.is_numeric_type () && y.is_numeric_type ()) + || (table.is_char_matrix () && y.is_char_matrix ())); bool str_case = table.is_cellstr () && (y.is_string () || y.is_cellstr ()); bool left_inf = false; bool right_inf = false; @@ -239,6 +240,11 @@ else if INT_ARRAY_LOOKUP (uint16) else if INT_ARRAY_LOOKUP (uint32) else if INT_ARRAY_LOOKUP (uint64) + else if (table.is_char_matrix () && y.is_char_matrix ()) + retval = do_numeric_lookup (table.char_array_value (), + y.char_array_value (), + left_inf, right_inf, + match_idx, match_bool); else if (table.is_single_type () || y.is_single_type ()) retval = do_numeric_lookup (table.float_array_value (), y.float_array_value (),